<?php
    @include_once("conn.php");

    $user = $_POST["user"]; // 对应字段名user,接收前端传过来的数据
    $pwd = $_POST["pwd"]; // 对应字段名pwd,接收前端传过来的数据
    $phone = $_POST["phone"]; // 对应字段名phone,接收前端传过来的数据
    

    if(!($user&&$pwd&&$phone)){  // 只要有参数没传  则会报错
        $msg = array();
        $msg["status"] = false;
        $msg["detail"] = "请传入完整参数";
        exit(json_encode($msg));
    }


    $insert = "insert into `userinfo_mz`(user,pwd,phone) value('$user','$pwd','$phone')";

    mysqli_query($conn,$insert);

    $rows = mysqli_affected_rows($conn);

    $msg = array();
    if($rows>0){
        $msg["status"] = true;
        $msg["detail"] = "注册成功";
    }else{
        $msg["status"] = false;
        $msg["detail"] = "注册失败";
        $msg["sql"] = $insert;
    }

    echo json_encode($msg);


?>